package br.com.sovi.resources;

import org.openinsula.vulcano.orm.command.DaoCommand;
import org.openinsula.vulcano.orm.dao.query.DaoQuery;
import org.openinsula.vulcano.orm.dao.query.builder.DaoSelect;

import br.com.sovi.persistence.Dispositivo;

@SuppressWarnings("serial")
public class FindDispositivoBySerialCommand extends DaoCommand<Dispositivo> {

	private String serial;

	public FindDispositivoBySerialCommand(String serial) {
		super();
		this.serial = serial;
	}

	@Override
	public Dispositivo execute() {
		DaoQuery<Dispositivo> query1 = new DaoSelect<Dispositivo>().all().from(Dispositivo.class).eq("serial", serial)
				.toQuery();

		return dao.findUnique(query1);
	}

}
